<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePortalCategoryTable extends Migration
{
    /**
     * 分类
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('portal_category', function (Blueprint $table) {
            $table->smallIncrements('id');
            $table->tinyInteger('site_id', false, true)->default(0)->comment('站点编号 默认 0:单站点;');
            $table->string('title', 100)->nullable()->comment('栏目名称');
            $table->tinyInteger('is_page', false, true)->default(0)->comment('是否时单页面 0:否');
            $table->string('title_en')->nullable()->comment('栏目英文名称');
            $table->string('description')->nullable()->comment('栏目简介');
            $table->tinyInteger('is_allow_content')->default(1)->comment('是否允许发布内容');
            $table->integer('cover_id', false, true)->default(0)->comment('封面图片编号');
            $table->string('cover')->nullable()->comment('封面图片地址');
            $table->char('document_type', 20)->nullable()->comment('文档类型 多个值用逗号隔开! 默认值： news:资讯; photo:图集');
            $table->string('document_thumb_wh')->nullable()->comment('内容缩略图(长X宽); 保存格式: 与配置中数组的保存格式一致');
            $table->smallInteger('pid', false, true)->default(0)->comment('父级栏目编号');
            $table->string('seo_title')->nullable()->comment('SEO标题');
            $table->string('seo_description')->nullable()->comment('SEO描述');
            $table->string('seo_keywords')->nullable()->comment('SEO关键字');
            $table->smallInteger('page_limit', false, true)->default(0)->comment('前台每页显示条数');
            $table->string('template_index')->nullable()->comment('前台分类首页模板');
            $table->string('template_list')->nullable()->comment('前台列表模板');
            $table->string('template_detail')->nullable()->comment('前台详情页模板');
            $table->tinyInteger('is_disabled')->default(1)->comment('前台是否禁用 1 禁用 0 不禁用');
            $table->string('create_name', 50)->nullable()->comment('后台发布用户名称');
            $table->tinyInteger('create_auth', false, true)->default(0)->comment('0:仅允许后台发布; 1:前台发布; 2:前后台都可以发布');
            $table->text('more')->nullable()->comment('扩展字段');
            $table->char('ip', 15)->nullable()->comment('ip地址');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('portal_category');
    }
}
